<?php

namespace common\validate;


class ProjectCapacityReportDaily extends BaseValidate
{
    // 验证规则
    protected $rule = [];

    // Fields 验证场景定义
    public function sceneFields()
    {
        return $this;
    }

    // Find 验证场景定义
    public function sceneFind()
    {
        return $this
            ->append("param", "require|array")
            ->append("param.filter", "require|array");
    }

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this
            ->append("param", "array")
            ->append("param.page", "array");
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data.name', 'require|max:128')
            ->append('data.code', 'max:128');
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data.id', 'require')
            ->append('data.name', 'max:128')
            ->append('data.code', 'max:128');
    }

    // Delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require');
    }

    // SelectByStepCategory 验证场景定义
    public function sceneSelectByStepCategory()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.step_category_id_list', 'require')
            ->append('param.start_time', 'require|integer')
            ->append('param.end_time', 'require|integer');
    }

    // SaveByStepCategory 验证场景定义
    public function sceneSaveByStepCategory()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.report_time', 'require|integer')
            ->append('param.step_category_id_list', 'require')
            ->append('param.number', 'integer|between:0,32140800');
    }

    // SaveByCapacityList 验证场景定义
    public function sceneSaveByCapacityList()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.year_month', 'require')
            ->append('param.capacity_report_list', 'require|array');
    }

    // GetStatisticsByRange 验证场景定义
    public function sceneGetStatisticsByRange()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.step_category_id_list', 'require')
            ->append('param.start_time', 'require|integer')
            ->append('param.end_time', 'require|integer');
    }

    // GetStatisticsByMonth 验证场景定义
    public function sceneGetStatisticsByMonth()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.step_category_id_list', 'require')
            ->append('param.year_month', 'require');
    }
}
